﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CustomExceptionHandling
{
    class CoffeeMachine
    {
        private int _coffee;
        private int _milk;
        public void Setup(int coffee, int milk)
        {
            if (coffee <= 0)
            {
                throw new ArgumentOutOfRangeException("coffee","Coffee Amount should be positive");
            }
            if (milk <= 0)
            {
                throw new ArgumentOutOfRangeException("milk","Milk amount should be positive");
            }
            if (coffee >= 1000)
            {
                throw new ArgumentOutOfRangeException("coffee","Coffee Amount should be less than 1000");
            }
            if (milk >= 500)
            {
                throw new ArgumentOutOfRangeException("milk", "Milk amount should be less than 500");
            }
            _coffee= coffee;
            _milk=milk;
        }
        public void GetCupOfCoffee()
        {
            if (_coffee < 50)
            {
                throw new NotEnoughIngredientException("coffee", "please refill coffee");
            }
            if (_milk < 50)
            {
                throw new NotEnoughIngredientException("Milk", "please refill milk");
            }
            _coffee -= 50;
            _milk -= 50;
        }
       
    }
}
